package main

import "fmt"

func testInsert() {
	var arr [20]int = [20]int{15, 9, 20, 23, 3, 4, 2, 5, 1, 10, 11, 17, 18, 19, 16, 24}

	root := createNode(arr[0])
	for i := 1; i < len(arr); i++ {
		if arr[i] == 0 {
			return
		}
		fmt.Printf("add : %d\n", arr[i])
		insert(root, arr[i])
		printfTree(root, 0)
		fmt.Println("-------")
	}
}

func testLL() {

	root := createNode(6)
	insert(root, 4)
	insert(root, 7)
	insert(root, 2)
	insert(root, 5)
	//insert(root, 1)
	insert(root, 3)
	printfTree(root, 0)
}

func testLL2() {

	root := createNode(6)
	insert(root, 4)
	insert(root, 2)
	printfTree(root, 0)
}

func testLL3() {

	root := createNode(6)
	insert(root, 4)
	insert(root, 7)
	insert(root, 2)
	insert(root, 5)
	insert(root, 1)
	//insert(root, 3)
	printfTree(root, 0)
}

func testLR() {

	root := createNode(6)

	insert(root, 2)
	insert(root, 7)
	insert(root, 1)
	insert(root, 4)
	//insert(root, 3)
	insert(root, 5)
	//turnLR(root)
	printfTree(root, 0)
}

func testLR2() {

	root := createNode(6)

	insert(root, 2)
	insert(root, 3)
	//turnLR(root)
	printfTree(root, 0)
}

func testRR() {

	root := createNode(2)

	insert(root, 1)
	insert(root, 4)
	insert(root, 3)
	insert(root, 6)
	insert(root, 5)
	//insert(root, 7)
	printfTree(root, 0)
}

func testRL() {

	root := createNode(2)

	insert(root, 1)
	insert(root, 6)
	insert(root, 7)
	insert(root, 4)
	//insert(root, 3)
	insert(root, 5)
	printfTree(root, 0)
}
